//
//  MethodExchangeVC.m
//  OCTest
//
//  Created by 韩艳锋 on 2018/4/27.
//  Copyright © 2018年 韩艳锋. All rights reserved.
//

#import "MethodExchangeVC.h"
#import <objc/runtime.h>

@interface MethodExchangeVC ()

@end

@implementation MethodExchangeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self isExchangeMethod1];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

+ (void)load {
    [super load];
    Method me1 = class_getInstanceMethod([self class], NSSelectorFromString(@"isExchangeMethod1"));
    Method me2 = class_getInstanceMethod([self class], NSSelectorFromString(@"isExchangeMethod2"));
    method_exchangeImplementations(me1, me2);
}

- (void)isExchangeMethod1 {
    NSLog(@"我是方法1");
}

- (void)isExchangeMethod2 {
    NSLog(@"我是方法2");
}

@end
